<!-- // created by: alfin akhret
// files dependency:
// - region_cluster.js
// - group_alias.php (controller)
// - mgroup_alias.php (model)
// - f-group_alias.php (view)
// - smooth.php (template) -->
<div class="box">
        <!-- box / title -->
        <div class="title">
                <h5>Usergroup Alias</h5>
                <ul class="links">
                        <!-- <li><a href="<?=base_url(); ?>index.php/group_alias">Tambahkan Group Alias</a></li>
                        <li><a href="<?=base_url(); ?>index.php/handset">Data Alias</a></li> -->
                </ul>
        </div>


        <?php
        $msg = $this->session->flashdata('message');
        if($msg <> ""){
              echo'<div id="box-messages">
                        <div class="messages">
                                <div id="message-success" class="message message-success">
                                        <div class="image">
                                                <img src="'. base_url() .'file/shell/smooth/resources/images/icons/success.png" alt="Success" height="32" />
                                        </div>
                                        <div class="text">
                                                <h6>'. $msg .'</h6>
                                        </div>
                                        <div class="dismiss">
                                                <a href="#message-success"></a>
                                        </div>
                                </div>
                        </div>
                </div>';
        }
        ?>
        <!-- end box / title -->
        <?php 
                if($alias_id!="")
                { ?>
                        <form id="form" action="<?=$_SERVER['PHP_SELF']?>/update_group_alias" method="post">
                <?php } else { ?>
                        <form id="form" action="<?=$_SERVER['PHP_SELF']?>/insert_group_alias" method="post">
                <?php } ?>
                        <div class="form">
                                <div class="fields">
                                        <div class="field">
                                                <div class="label">
                                                        <label for="region">User Group Alias Name:</label>
                                                </div>
                                                <div class="input">
                                                        <input type="text" id="alias" name="alias_name" class="small" value="<?php echo $alias_name;?>"/>     
                                                </div>
                                        </div>
                                        <div class="field">
                                                <div class="label">
                                                        <label for="cluster">User Group Name:</label>
                                                </div>
                                                <div class="input">
                                                        <select id="user_group" name="user_group_id" class="medium">
                                                        
                                                                <?php
                                                                        foreach ($user_group_data as $r) {
                                                                             if($r->user_group_id == $user_group_id)
                                                                             {   
                                                                                echo '<option value="'.$r->user_group_id.'" selected>'.$r->user_group_name.'</option>';
                                                                             }
                                                                             else 
                                                                             {
                                                                                echo '<option value="'.$r->user_group_id.'">'.$r->user_group_name.'</option>';
                                                                             }
                                                                        }
                                                                ?>
                                                        </select>
                                                </div>
                                        </div>

                                        <div class="buttons">
                                                <?php 
                                                   if($alias_id != "")
                                                   {
                                                ?>
                                                        <input type="hidden" name="alias_id" value="<?php echo $alias_id;?>">
                                                        <input type="submit" name="submit" value="Update" id="submit"/>
                                                <?php
                                                   }
                                                   else
                                                   {
                                                ?>
                                                        <input type="submit" name="submit" value="Submit" id="submit"/>
                                                                   
                                                <?php   } ?>        
                                                
                                        </div>
                                
                                </div>
                        </div>
                        
                </form><br><br>

                <div class="table">
                <base href="<?php echo base_url() ?>" />
                <div id="ajaxLoadAni">
                        <img src="file/smooth/images/ajax-loader.gif" alt="Ajax Loading Animation" />
                        <span>Mohon Tunggu...</span>
                </div>
                <?=$this->load->view("grid-group-alias");?>
        </div>
       
</div>
